/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ipodhash;

import ipodhash.beans.Serializa;
import ipodhash.beans.Musica;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.farng.mp3.MP3File;
import org.farng.mp3.TagException;

/**
 *
 * @author rooke
 */
public class TesteSerializacao {

    /**
     * @param args the command line arguments
     */
    public static void main2(String[] args) {
        // TODO code application logic here

        try {


            String a,b;

            a = "aa";
            b = "bb";

            System.out.println(a.compareTo(b));
            System.out.println(b.compareTo(a));


            File sourceFile = null;
            MP3File mp3file = new MP3File("/home/rooke/teste.mp3");
            mp3file.getID3v1Tag().getArtist();
            mp3file.getID3v1Tag().getTitle();

            Musica music = new Musica();
            music.setAlbum(mp3file.getID3v1Tag().getAlbum());
            music.setArtista(mp3file.getID3v1Tag().getArtist());
            music.setTitulo(mp3file.getID3v1Tag().getTitle());
            music.setChave(music.getArtista(), music.getAlbum());

            MP3File mp3file2 = new MP3File("/home/rooke/teste2.mp3");
            mp3file2.getID3v1Tag().getArtist();
            mp3file2.getID3v1Tag().getTitle();

            Musica music2 = new Musica();
            music2.setAlbum(mp3file2.getID3v1Tag().getAlbum());
            music2.setArtista(mp3file2.getID3v1Tag().getArtist());
            music2.setTitulo(mp3file2.getID3v1Tag().getTitle());
            music2.setChave(music2.getArtista(), music2.getAlbum());




            ArrayList<Musica> musicas = new ArrayList<Musica>();
            ArrayList<Musica> musicas2 = null;

            musicas.add(music);
            musicas.add(music2);

            Serializa.serializaArrayListMusica(musicas,1);
            Serializa.serializaArrayListMusica(musicas,1);
            try {
                musicas2 = Serializa.desserializaArrayListMusica(1);
            } catch (FileNotFoundException ex) {
                Logger.getLogger(TesteSerializacao.class.getName()).log(Level.SEVERE, null, ex);
            } catch (ClassNotFoundException ex) {
                Logger.getLogger(TesteSerializacao.class.getName()).log(Level.SEVERE, null, ex);
            }
            System.out.println(musicas2.get(0).getAlbum());
            System.out.println(musicas2.get(1).getTitulo());

            System.out.println(musicas2.size());


        } catch (IOException iOException) {
        } catch (TagException tagException) {
        }


    }
}
